﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>注册审核</title>
    <link href="../css/main.css" rel="stylesheet" type="text/css" />
    <link href="../css/Jqbox.css" rel="stylesheet" type="text/css" />
    <link href="../css/jquery.loadmask.css" rel="stylesheet" type="text/css" />
    <script src="../js/jquery-1.5.2.min.js" type="text/javascript"></script>
    <script src="../js/ligerui.min.js" type="text/javascript"></script>
    <script src="../Js/jquery.dialog.js" type="text/javascript"></script>
    <script src="../Js/jquery.loadmask.min.js" type="text/javascript"></script>
    <script src="../Js/conmon.js" type="text/javascript"></script>
    <script type="text/javascript">
        var $grid;
        $(function () {


            //显示gride
            $grid = $("#maingrid").ligerGrid({
                columns: [
                 { display: '序号', align: 'left', width: 40, type: 'int', isSort: false,
                     render: function (item, i) {
                         i = i + 1;
                         return i;
                     }
                 },
                { display: '姓名', name: 'M_NAME', align: 'left', width: 80 },
                { display: '工号', name: 'M_CODE', width: 120 },
                { display: '性别', name: 'M_SEX', width: 50,
                    render: function (item) {
                        if (item.M_SEX == 0) return "女";
                        else return "男";
                    }
                },
                { display: '电话', name: 'M_PHONE', width: 100 },
                { display: '区域', name: 'A_NAME', width: 160 },
                { display: '职务', name: 'R_NAME', width: 120 },
                { display: '部门', name: 'M_DEPAT', width: 120 },

                { display: '注册时间', name: 'M_DATE', type: 'date', dateFormat: "yyyy-MM-dd" },
                 { display: '状态', name: 'M_STATUS', isSort: false, width: 60,
                     render: function (item) {
                         if (item.M_STATUS == -1) return "待审核";
                         else if (item.M_STATUS == 0) return "正常";
                         else if (item.M_STATUS == 1) return "停用";

                     }
                 },
                 { display: '操作', name: 'M_ID', isSort: false, width: 40,
                     render: function (item) {
                         return "<a   onclick='Aduit(" + item.M_ID + ")' href='javascript:' >审核</a>";

                     }
                 },
                 { display: '删除', name: 'M_ID', isSort: false, width: 40,
                     render: function (item) {
                         return "<a   onclick='deleteItem(" + item.M_ID + ",&quot;" + item.M_NAME + "&quot;)' href='javascript:' >删除</a>";

                     }
                 }
                 

                ],
                 parms: [{ name: 'userName', value: $("#txtuserName").val()}],
                dataAction: 'server', pageSize: 20,
                url: '../WebServer/MainAdmin.ashx?Action=RegAudit',
                sortName: 'M_NAME',
                width: '99%', height: '96%'
            });

        });

        function Search() {
            reloadgrid();
        }
        function reloadgrid() {

            if (!$grid) return;

            $("tbody > tr", $grid.gridbody).each(function () {
                $(this).remove();
            });

            $grid.setOptions(
                { parms: [{ name: 'userName', value: $("#txtuserName").val()}], newPage: 1, Rows: [], Total: 0, heightDiff: 0 }
                );

            $grid.loadData(true);
        }
        //
        function Aduit(vl) {
            $("body").mask("数据处理中，请稍候......");

            $.getJSON('../WebServer/MainAdmin.ashx?Action=AuditItem', { userid: vl }, function (data) {
                $("body").unmask();
                if (data.IsSuccess == 1) {
                    showAlertOk("审核成功");
                 
                    reloadgrid();
                } else {
                    showErrorTip(data.Msg);
                }
            });
        }
        function deleteItem(vl,vname) {

            jqConfirm("你确定删除[" + vname + "]吗？", "提示", function (v) {
                if (v == 'ok') {
                    $("body").mask("数据处理中，请稍候......");
                    $.getJSON('../WebServer/MainAdmin.ashx?Action=DeleteItem', { userid: vl }, function (data) {
                        $("body").unmask();
                        if (data.IsSuccess == 1) {
                            showAlertOk("删除成功");
                            reloadgrid();
                        } else {
                            showErrorTip(data.Msg);
                           
                        }
                    });//end ajax
                }//end if

            });
        }
    </script>
</head>
<body>
      <div class="l-panel-search">
        <div class="l-panel-search-item">
          <span> 用户名：</span>
        </div>
        <div class="l-panel-search-item">
            <input id="txtuserName" type="text" />
        </div>
        <div class="l-panel-search-item">
         <input type="button" id="btnGet" value="查询" class="l-button" onclick="Search();"/>
        </div>
   </div>
     <div id="maingrid"></div> 
</body>
</html>
